<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 给量词的情况下，默认取最大值，默认是贪婪的
        var str = "19028448askdh545"
        var reg = /\d{3,6}/
        console.log(str.replace(reg,"*")); // *48askdh545

        // 懒惰模式
        var str = "82178212jkbcckj"
        var reg = /\d{3,6}?/
        console.log(str.replace(reg,"*")); // *78212jkbcckj

    </script>
</body>
</html>